﻿#region Using Statements
using System;
using System.Collections.Generic;
using System.Linq;
using System.Media;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using System.Diagnostics;
using System.IO;
#endregion Using Statements

namespace CakeRaid
{
    // Constant/Static variables go here
    public delegate void ButtonEvent(Button bttn);
    class Var
    {
        #region Screen/Map Stuff
        public static int TOTAL_WIDTH = 1280, TOTAL_HEIGHT = 720, TILE_SIZE = 40, DISPLAY_SIZE = 60;
        public static Rectangle SCREEN_SIZE = new Rectangle(0, 0, TOTAL_WIDTH, TOTAL_HEIGHT);
        public static Rectangle GAME_AREA = new Rectangle(0, 0, TOTAL_WIDTH, TOTAL_HEIGHT);

        //global health bar values
        public static Texture2D BLANK_TEX;
        public static TimeSpan SHOW_HEALTH_TIME = new TimeSpan(0, 0, 5);
        public static Point HEALTHBAR_SIZE_MAX = new Point(75, 5);

        //max amount of different cake art
        public static int MAX_CAKE = 5;

        //link forced level to level selection code if not minimum
        public const int FORCED_LEVEL = 0;
        #endregion Screen/Map Stuff
        
        #region Cake / HUD
        public static int MAX_CAKE_HEALTH = 5 /*base is 5*/, START_MONEY = 850; /*base is 850*/
        public static TimeSpan MENU_ACTION_TIME = new TimeSpan(0, 0, 0, 0, 500), SAVE_MESSAGE_TIME = new TimeSpan(0, 0, 5);
        #endregion Cake / HUD

        #region Tower
        public static TimeSpan TOWER_SHOW_HEALTH_TIME = new TimeSpan(0, 0, 1);

        public static int RAD_TOWER_HEALTH = 400;
        public static int SHOCK_TOWER_HEALTH = 800;
        public static int FIREBALL_TOWER_HEALTH = 800;
        public static int LIGHT_TOWER_HEALTH = 1200;

        public static int TOWER_SIZE = 40;

        public static Dictionary<TowerType, string> towerNames = new Dictionary<TowerType, string>
        {
            { TowerType.Rad, "Rad Tower" },
            { TowerType.Shock, "Shock Tower" },
            { TowerType.Fire, "Fireball Tower" },
            { TowerType.Light, "Light Tower" }
        };
        #endregion Tower

        #region Trap
        public static TimeSpan TRAP_SHOW_HEALTH_TIME = new TimeSpan(0, 0, 1);
        public static int ACID_TRAP_HEALTH = 5;
        public static int FLYPAPER_TRAP_HEALTH = 5;
        public static int ZAPPER_TRAP_HEALTH = 300;
        public static int ZAPPER_TRAP_RANGE = 120;
        public static int SNARE_TRAP_HEALTH = 1;

        public static int TRAP_SIZE = 30;
        
        public static Dictionary<TrapType, string> trapNames = new Dictionary<TrapType, string>
        {
            { TrapType.Acid, "Acid Trap" },
            { TrapType.Flypaper, "Flypaper Trap" },
            { TrapType.Zapper, "Zapper Trap" },
            { TrapType.Snare, "Snare Trap" }
        };
        #endregion Trap

        #region Bullet
        public static float BASE_BULLET_SPEED = 4;
        public const int BULLET_SIZE = 10;
        #endregion Bullet

        #region Enemy
        //global base values
        public static int SPAWN_SPINS = 1, DEATH_SPINS = 3, ENEMY_SIZE = 30, BOSS_SIZE = 120;
        public const float ENEMY_SLOW_CAP = .25f, WAVES_DIFFICULTY_INCREASE = .1f, ENEMY_ATTACK_RANGE = 40f;
        public static TimeSpan SPAWN_TIME = new TimeSpan(0, 0, 0, 0, 500);
        public static TimeSpan DESPAWN_TIME = new TimeSpan(0, 0, 1);
        public static TimeSpan DYING_TIME = new TimeSpan(0, 0, 1);
        public enum StatusType { Slowed, Shocked, Healing, Attracted }
        public static TimeSpan STATUS_TIME = new TimeSpan(0, 0, 2);

        #region Specific enemy type values
        //Ant
        public static int ANT_HEALTH = 10;
        public static int ANT_DAMAGE = 1;
        public static float ANT_SPEED = 1.6f;

        //Spider
        public static int SPIDER_HEALTH = 25;
        public static int SPIDER_DAMAGE = 2;
        public static float SPIDER_SPEED = 1.0f;

        //Beetle
        public static int BEETLE_HEALTH = 50;
        public static int BEETLE_DAMAGE = 1;
        public static float BEETLE_SPEED = 0.7f;

        //Bee
        public static int BEE_HEALTH = 10;
        public static int BEE_DAMAGE = 2;
        public static float BEE_SPEED = 1.6f;

        //Wasp
        public static int WASP_HEALTH = 25;
        public static int WASP_DAMAGE = 4;
        public static float WASP_SPEED = 1.6f;

        //Dragonfly
        public static int DRAGONFLY_HEALTH = 20;
        public static int DRAGONFLY_DAMAGE = 3;
        public static float DRAGONFLY_SPEED = 1.6f;

        //Ladybug
        public static int LADYBUG_HEALTH = 15;
        public static int LADYBUG_DAMAGE = 0;
        public static int LADYBUG_HEAL_AMT = 2;
        public static float LADYBUG_SPEED = 1.0f;
        public static float LADYBUG_HEAL_RADIUS = 150f;

        //Spider Boss
        public static int BOSS_HEALTH = 3000;
        public static int BOSS_DAMAGE = 2;
        public static float BOSS_SPEED = 0.5f;
        #endregion Specific enemy type values

        #endregion Enemy

        #region Time Stuff
        public static int GAME_SPEED = 1;
        //possibly tweak to animate bugs more smoothly
        public static int FRAME_SPEED = 200;

        public static TimeSpan TIME_BETWEEN_SPAWNS = new TimeSpan(0, 0, 0, 0, 1000);
        public static TimeSpan TIME_BETWEEN_WAVES = new TimeSpan(0, 0, 15);
        #endregion Time Stuff

        #region Enums
        public enum EnemyType { Ant, Spider, Beetle, Bee, Wasp, Dragonfly, Ladybug, SpiderBoss }
        public enum TowerType { Rad, Shock, Fire, Light }
        public enum TrapType { Acid, Flypaper, Zapper, Snare }
        #endregion Enums

        #region Colors
        public static float PLACING_TRANSPARENCY = 60f;
        public static Color PAUSE_GRAY = Color.FromNonPremultiplied(50, 50, 50, 200);

        public static Color EffectTransparency(float percent, Color clr)
        {
            return Color.FromNonPremultiplied(clr.R, clr.G, clr.B, (byte)(clr.A * percent));
        }
        #endregion Colors
    }
}